let plugins = [];
if (process.env.NODE_ENV === 'production') {
	plugins.push("transform-remove-console")
}
export default {
	// Global page headers: https://go.nuxtjs.dev/config-head
	head: {
		title: 'Pre-registration',
		htmlAttrs: {
			lang: 'en'
		},
		meta: [{
			charset: 'utf-8'
		},
		/*优先使用 IE 最新版本和 Chrome*/
		{
			"http-equiv": "X-UA-Compatible",
			content: "IE=edge,chrome=1"
		},
		{
			name: 'viewport',
			content: 'width=device-width, initial-scale=1'
		},
		{
			hid: "keywords",
			name: "keywords",
			content: ''
		},
		{
			hid: 'description',
			name: 'description',
			content: ''
		},
		{
			name: 'format-detection',
			content: 'telephone=no'
		}
		],
		link: [{
			rel: 'icon',
			type: 'image/x-icon',
			href: '/favicon.ico'
		},
		],
		script: [{
			src: '/qrcode.min.js'
		}]
	},

	// Global CSS: https://go.nuxtjs.dev/config-css
	css: [{
		src: 'view-design/dist/styles/iview.css'
	},
	{
		src: '~/assets/styles/index.less',
		lang: 'less'
	},
	],

	// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
	plugins: [{
		src: '~plugins/view-ui'
	},
	{
		src: '~plugins/vant'
	},
	{
		src: '~plugins/axios'
	},
	{
		src: '~plugins/comm'
	},
	{
		src: '~plugins/site-mixin'
	},
	],

	// Auto import components: https://go.nuxtjs.dev/config-components
	components: true,

	// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
	buildModules: [
		'@nuxtjs/style-resources',
	],
	styleResources: {
		less: [
		],
		hoistUseStatements: true
	},

	// Modules: https://go.nuxtjs.dev/config-modules
	modules: [
		"@nuxtjs/axios", "@nuxtjs/proxy",
	],
	/*
	 ** axios proxy
	 */
	axios: {
		proxy: true,
		//最多重发0次
		retry: {
			retries: 0
		},
		prefix: '/hboot', // baseURL
		//是否是可信任
		withCredentials: true,
		//跨域请求是否需要使用凭证
		credentials: true,
		headers: {
			//'Content-Type': 'application/json',
			'crossDomain': true,
			"Access-Control-Allow-Origin": "*"
		},
		timeout: 15000
	},
	/*
	 ** proxy
	 */
	proxy: {
		// '/hboot': {
			// target: 'https://www.ip365x.com/', // 代理地址
			// target: 'http://ip365x.highset.cn', // 代理地址
			//target: 'http://127.0.0.1:8080', // 代理地址
			// changeOrigin: true, //是否跨域
			// pathRewrite: {
			//   '^/hboot': '', //将 /hboot 替换掉
			// }
		// },
	},
	/*
	 ** Customize the progress bar color
	 */
	loading: {
		color: '#3B8070',
		height: "2px"
	},

	// Build Configuration: https://go.nuxtjs.dev/config-build
	build: {
		// 分析打包数据使用，平时不用 2021年11月01日14:14:06
		// analyze: true,
		// assetFilter: function (assetFilename) { 
		//   return assetFilename.endswith('.js')
		// },
		// 分析打包数据 end
		vendor: ["axios"], // 为防止重复打包
		//提取css到单独link文件
		// extractCSS: {
		// 	allChunks: true
		// },
		optimization: {
			splitChunks: {
				chunks: 'all',
			}
		},
		loaders: {
			less: {
				javascriptEnabled: true,
			}
		},
		babel: {
			plugins
		},
	}
}
